<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../../resources/templates/login.xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:sec="http://www.springframework.org/security/facelets/tags" >

    <ui:define name="menu_horizontal">
        <sec:ifAnyGranted roles="ROLE_SERVIDOR,ROLE_ADMINISTRADOR">
            <ui:include src="/site/acessoServidor/menu.xhtml" />
        </sec:ifAnyGranted>
    </ui:define>
    
    <ui:define name="corpo">
        <sec:ifAnyGranted roles="ROLE_SERVIDOR,ROLE_ADMINISTRADOR">
            
            <h:form id="formSalvar">
                <p:growl id="growl" showDetail="true" sticky="true" /> 
                <p:panel  header="Manter Matriz Curricular"> 
                    <p:messages id="msgs"/> 
                    <h:panelGrid columns="2" >

                        Data desejada:<p:calendar value="#{controllerPonto.ponto.dia}" required="true" requiredMessage="Data obrigatória." style="width: 200px"/>
                        Entrada matutina:<p:calendar value="#{controllerPonto.ponto.entrada_matutina}" pattern="HH:mm" timeOnly="true" style="width: 200px"/>
                        Saída matutina:<p:calendar value="#{controllerPonto.ponto.saida_matutina}" pattern="HH:mm" timeOnly="true" style="width: 200px"/>
                        Entrada vespertina:<p:calendar value="#{controllerPonto.ponto.entrada_vespertina}" pattern="HH:mm" timeOnly="true" style="width: 200px"/>
                        Saída vespertina:<p:calendar value="#{controllerPonto.ponto.saida_vespertina}" pattern="HH:mm" timeOnly="true" style="width: 200px"/>
                        Entrada noturna<p:calendar value="#{controllerPonto.ponto.entrada_noturna}" pattern="HH:mm" timeOnly="true" style="width: 200px"/>
                        Saída noturna<p:calendar value="#{controllerPonto.ponto.saida_noturna}" pattern="HH:mm" timeOnly="true" style="width: 200px"/>
                        <p:commandButton value="Inserir" actionListener="#{controllerPonto.salvar()}" update="@form" ajax="true"/>

                    </h:panelGrid>
                </p:panel>
                <p:dataTable id="tabela" var="p" value="#{controllerPonto.listaDM}" emptyMessage="Não há resultados para hoje.">
                    <p:column headerText="Data" filterBy="#{p.dia}">
                        <h:outputText value="#{p.dia}">
                            <f:convertDateTime pattern="dd/MM/yyyy"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Entrada Matutina">
                        <h:outputText value="#{p.entrada_matutina}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Saída Matutina">
                        <h:outputText value="#{p.saida_matutina}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Entrada Vespertina">
                        <h:outputText value="#{p.entrada_vespertina}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Saída Vespertina">
                        <h:outputText value="#{p.saida_vespertina}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Entrada Noturna">
                        <h:outputText value="#{p.entrada_noturna}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Saída Noturna">
                        <h:outputText value="#{p.saida_noturna}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    
                </p:dataTable>
            </h:form>
            
            
        </sec:ifAnyGranted>
    </ui:define>
    
</ui:composition>
